import { Observable } from 'rxjs/RX';
import { Injectable } from '@angular/core';
import {Request,Response} from '@angular/http';

@Injectable()
export class HttpInterceptorService{
    /**
     * 请求之前
     * @param req 
     */
    beforeRequest(req:Request):Request{
        console.log(req);
        return req;
    }

    /**
     * 响应
     * @param res 
     */
    afterResponse(res:Observable<Response>):Observable<any>{
        res.subscribe(data=>{
            console.log(data);
        });

        return res;
    }
}